import Home from '@/pages/Home'
import Detail from '@/pages/Detail'

export default [
    {
      path:'/Home',
      name: 'Home',
      component:Home,
      meta: { show : true }
    },
    {
      path:'/Detail/:id',
      name: 'Detail',
      component:Detail,
      meta: { show : true }
    },
    {
      path:'/shopCart',
      name: 'ShopCart',
      component:()=>import('@/pages/ShopCart'),
      meta: { show : true }
    },
    {
      path:'/paysuccess',
      name: 'PaySuccess',
      component:()=>import('@/pages/PaySuccess'),
      meta: { show : true },
      beforeEnter (to, from, next) {
        if (from.path==='/pay') {
          next()
        } else {
          next('/pay')
        }
      }
    },
    {
      path:'/trade',
      name: 'Trade',
      component:()=>import('@/pages/Trade'),
      meta: { show : true }
    },
    {
      path:'/pay',
      name: 'Pay',
      component:()=>import('@/pages/Pay'),
      meta: { show : true },
      beforeEnter: (to, from,next) => {
        if(from.path == '/trade'){
          next()
        }else{
          return false
        }
      },
    },
    {
      path:'/addcartsuccess',
      name: 'addcartsuccess',
      component:() => import('@/pages/AddCartSuccess'),
      meta: { show : true }
    },
    {
      path:'/Login',
      name: 'Login',
      component: resolve => require(['@/pages/Login'], resolve),
      meta: { show : false }
    },
    {
      path:'/Register',
      name: 'Register',
      component: resolve => require(['@/pages/Register'], resolve),
      meta: { show : false }
    },
    {
      path:'/Search/:keyword?',
      name:'Search',
      component: resolve => require(['@/pages/Search'], resolve),
      meta: { show : true }
    },
    {
      path:'/center',
      name:'Center',
      component: resolve => require(['@/pages/Center'], resolve),
      meta: { show : true },
      children:[
        {
          path:'/center/groupOrder',
          name:'groupOrder',
          component: resolve => require(['@/pages/Center/groupOrder'], resolve),
        },
        {
          path:'myOrder',
          name:'myOrder',
          component: resolve => require(['@/pages/Center/myOrder'], resolve),
        },
        {
          path: '',
          redirect: 'myorder'
        }
      ]
    },
  ]   